package me.zk.practice1.s;

/**
 * @author zhangkai
 * @date 2023/7/28 11:52
 */
public class LS7 {
    public static int reverse(int x) {
        if (x == 0) {
            return 0;
        }
        int s = 0;
        int maxValue = Integer.MAX_VALUE/10;
        int minValue = Integer.MIN_VALUE/10;
        while (x != 0) {
            int a = x%10;
            if (s > maxValue || s<minValue) {
                return 0;
            }
            s = s* 10 + a;
            x = x/10;
        }
        return s;
    }

    public static void main(String[] args) {
        System.out.println(reverse(1534236469));
    }
}
